///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 21 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////

#include "doubleimagedialog.h"

///////////////////////////////////////////////////////////////////////////

DoubleImageDialog::DoubleImageDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );

	wxBoxSizer* bSizer1;
	bSizer1 = new wxBoxSizer( wxVERTICAL );

	wxBoxSizer* bSizer2;
	bSizer2 = new wxBoxSizer( wxHORIZONTAL );

	wxBoxSizer* bSizer8;
	bSizer8 = new wxBoxSizer( wxVERTICAL );

	wxBoxSizer* bSizer10;
	bSizer10 = new wxBoxSizer( wxVERTICAL );

	m_staticText1 = new wxStaticText( this, wxID_ANY, wxT("Open Image 1:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText1->Wrap( -1 );
	bSizer10->Add( m_staticText1, 0, wxALL, 5 );

	bSizer8->Add( bSizer10, 1, wxEXPAND, 5 );

	m_textCtrl_im1 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	bSizer8->Add( m_textCtrl_im1, 0, wxALL|wxEXPAND, 5 );

	wxBoxSizer* bSizer12;
	bSizer12 = new wxBoxSizer( wxVERTICAL );

	bSizer8->Add( bSizer12, 1, wxEXPAND, 5 );

	bSizer2->Add( bSizer8, 3, wxEXPAND, 5 );

	wxBoxSizer* bSizer9;
	bSizer9 = new wxBoxSizer( wxVERTICAL );

	wxBoxSizer* bSizer13;
	bSizer13 = new wxBoxSizer( wxVERTICAL );

	bSizer9->Add( bSizer13, 1, wxEXPAND, 5 );

	m_button5 = new wxButton( this, wxID_ANY, wxT("Open Image 1"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer9->Add( m_button5, 0, wxALIGN_CENTER|wxALL, 5 );

	wxBoxSizer* bSizer14;
	bSizer14 = new wxBoxSizer( wxVERTICAL );

	bSizer9->Add( bSizer14, 1, wxEXPAND, 5 );

	bSizer2->Add( bSizer9, 1, wxEXPAND, 5 );

	bSizer1->Add( bSizer2, 2, wxEXPAND, 5 );

	wxBoxSizer* bSizer3;
	bSizer3 = new wxBoxSizer( wxHORIZONTAL );

	wxBoxSizer* bSizer81;
	bSizer81 = new wxBoxSizer( wxVERTICAL );

	wxBoxSizer* bSizer101;
	bSizer101 = new wxBoxSizer( wxVERTICAL );

	m_staticText2 = new wxStaticText( this, wxID_ANY, wxT("Open Image 2:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText2->Wrap( -1 );
	bSizer101->Add( m_staticText2, 0, wxALL, 5 );

	bSizer81->Add( bSizer101, 1, wxEXPAND, 5 );

	m_textCtrl_im2 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	bSizer81->Add( m_textCtrl_im2, 0, wxALL|wxEXPAND, 5 );

	wxBoxSizer* bSizer121;
	bSizer121 = new wxBoxSizer( wxVERTICAL );

	bSizer81->Add( bSizer121, 1, wxEXPAND, 5 );

	bSizer3->Add( bSizer81, 3, wxEXPAND, 5 );

	wxBoxSizer* bSizer91;
	bSizer91 = new wxBoxSizer( wxVERTICAL );

	wxBoxSizer* bSizer131;
	bSizer131 = new wxBoxSizer( wxVERTICAL );

	bSizer91->Add( bSizer131, 1, wxEXPAND, 5 );

	m_button51 = new wxButton( this, wxID_ANY, wxT("Open Image 2"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer91->Add( m_button51, 0, wxALIGN_CENTER|wxALL, 5 );

	wxBoxSizer* bSizer141;
	bSizer141 = new wxBoxSizer( wxVERTICAL );

	bSizer91->Add( bSizer141, 1, wxEXPAND, 5 );

	bSizer3->Add( bSizer91, 1, wxEXPAND, 5 );

	bSizer1->Add( bSizer3, 2, wxEXPAND, 5 );

	wxBoxSizer* bSizer4;
	bSizer4 = new wxBoxSizer( wxHORIZONTAL );

	wxBoxSizer* bSizer5;
	bSizer5 = new wxBoxSizer( wxVERTICAL );

	m_button4 = new wxButton( this, wxID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer5->Add( m_button4, 0, wxALIGN_CENTER|wxALL, 5 );

	bSizer4->Add( bSizer5, 1, wxEXPAND, 5 );

	wxBoxSizer* bSizer7;
	bSizer7 = new wxBoxSizer( wxVERTICAL );

	m_button41 = new wxButton( this, wxID_CANCEL, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer7->Add( m_button41, 0, wxALL, 5 );

	bSizer4->Add( bSizer7, 1, wxEXPAND, 5 );

	bSizer1->Add( bSizer4, 1, wxEXPAND, 5 );

	this->SetSizer( bSizer1 );
	this->Layout();

	// Connect Events
	m_button5->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DoubleImageDialog::ID_OPENIMAGE1 ), NULL, this );
	m_button51->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DoubleImageDialog::ID_OPENIMAGE2 ), NULL, this );
    lastDirectory=wxT(".");
}

DoubleImageDialog::~DoubleImageDialog()
{
	// Disconnect Events
	m_button5->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DoubleImageDialog::ID_OPENIMAGE1 ), NULL, this );
	m_button51->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DoubleImageDialog::ID_OPENIMAGE2 ), NULL, this );

}

void DoubleImageDialog::ID_OPENIMAGE1( wxCommandEvent& event )
{
    wxString path;
    wxString caption = wxT("Choose Image 1");
    wxString wildcard =
        wxT( "image files (*.bmp;*.gif;*.png;*.ppm;*.jpg;*.tif;*.pgm)|*.bmp;*.gif;*.png;*.ppm;*.jpg;*.tif;;*.pgm");
    wxString defaultDir = lastDirectory;
    wxString defaultFilename = wxEmptyString;
    wxFileDialog dialog(this, caption, defaultDir, defaultFilename,wildcard, wxOPEN);
    if (dialog.ShowModal() == wxID_OK)
    {
    path = dialog.GetPath();
     wxString pathtest=wxT("hello dude test");

        char tempbuf[100];
        strcpy( tempbuf, (const char*)path.mb_str(wxConvUTF8) );
        printf("path is %s \n",tempbuf );

          m_textCtrl_im1->SetValue(path);


      wxFileName dirname=path;
 lastDirectory=dirname.GetPath();


    }

}
void DoubleImageDialog::ID_OPENIMAGE2( wxCommandEvent& event )
{



        wxString caption = wxT("Choose Image 2");
    wxString wildcard =
                       wxT( "image files (*.bmp;*.gif;*.png;*.ppm;*.jpg;*.tif;*.pgm)|*.bmp;*.gif;*.png;*.ppm;*.jpg;*.tif;;*.pgm");
    wxString defaultDir = lastDirectory;
    wxString defaultFilename = wxEmptyString;
    wxFileDialog dialog(this, caption, defaultDir, defaultFilename,wildcard, wxOPEN);
    if (dialog.ShowModal() == wxID_OK)
    {
        wxString path = dialog.GetPath();
           char tempbuf[100];
        strcpy( tempbuf, (const char*)path.mb_str(wxConvUTF8) );
        printf("path is %s \n",tempbuf );
        m_textCtrl_im2->SetValue(path);
      wxFileName dirname=path;
 lastDirectory=dirname.GetPath();
    }

}
